In [4]:
import pandas as pd
import numpy as np

In [6]:
fn1 = 'EPA emissions.txt'
fn2 = 'may_generator2016.xlsx'
fn3 = 'EIA923_Schedules_2_3_4_5_M_10_2016.xlsx'

Load emissions data


In [7]:
emissions = pd.read_csv(fn1)

In [8]:
emissions.head()


Out[8]:
State Facility Name Facility ID (ORISPL) Unit ID Associated Stacks Month Year Program(s) Operating Time Gross Load (MW-h) Steam Load (1000lb) SO2 (tons) Avg. NOx Rate (lb/MMBtu) NOx (tons) CO2 (short tons) Heat Input (MMBtu) EPA Region NERC Region Unit Type Fuel Type (Primary)
AL AMEA Sylacauga Plant 56018 1 NaN 5 2016 CSNOX, CSNOXOS, CSSO2G2, ARP 28.00 1149.0 NaN 0.004 0.0759 0.473 732.800 12428.200 4 SERC Combustion turbine Pipeline Natural Gas NaN
AL AMEA Sylacauga Plant 56018 2 NaN 5 2016 CSNOX, CSNOXOS, CSSO2G2, ARP 17.00 642.0 NaN 0.002 0.0809 0.283 412.300 6984.600 4 SERC Combustion turbine Pipeline Natural Gas NaN
AL Barry 3 1 CS0AAN 5 2016 ARP, CSNOX, CSNOXOS, CSSO2G2 2.75 11.0 NaN 0.005 0.0080 0.001 14.213 240.050 4 SERC Tangentially-fired Pipeline Natural Gas NaN
AL Barry 3 2 CS0AAN 5 2016 ARP, CSNOX, CSNOXOS, CSSO2G2 2.75 11.0 NaN 0.005 0.0080 0.001 14.213 240.050 4 SERC Tangentially-fired Pipeline Natural Gas NaN
AL Barry 3 4 NaN 5 2016 ARP, MATS, CSNOX, CSNOXOS, CSSO2G2 725.25 116336.0 NaN 572.537 0.4319 265.224 128402.000 1251483.675 4 SERC Tangentially-fired Coal NaN

In [9]:
emissions = pd.read_csv(fn1, index_col=False)
emissions.head()


Out[9]:
State Facility Name Facility ID (ORISPL) Unit ID Associated Stacks Month Year Program(s) Operating Time Gross Load (MW-h) Steam Load (1000lb) SO2 (tons) Avg. NOx Rate (lb/MMBtu) NOx (tons) CO2 (short tons) Heat Input (MMBtu) EPA Region NERC Region Unit Type Fuel Type (Primary)
0 AL AMEA Sylacauga Plant 56018 1 NaN 5 2016 CSNOX, CSNOXOS, CSSO2G2, ARP 28.00 1149.0 NaN 0.004 0.0759 0.473 732.800 12428.200 4 SERC Combustion turbine Pipeline Natural Gas
1 AL AMEA Sylacauga Plant 56018 2 NaN 5 2016 CSNOX, CSNOXOS, CSSO2G2, ARP 17.00 642.0 NaN 0.002 0.0809 0.283 412.300 6984.600 4 SERC Combustion turbine Pipeline Natural Gas
2 AL Barry 3 1 CS0AAN 5 2016 ARP, CSNOX, CSNOXOS, CSSO2G2 2.75 11.0 NaN 0.005 0.0080 0.001 14.213 240.050 4 SERC Tangentially-fired Pipeline Natural Gas
3 AL Barry 3 2 CS0AAN 5 2016 ARP, CSNOX, CSNOXOS, CSSO2G2 2.75 11.0 NaN 0.005 0.0080 0.001 14.213 240.050 4 SERC Tangentially-fired Pipeline Natural Gas
4 AL Barry 3 4 NaN 5 2016 ARP, MATS, CSNOX, CSNOXOS, CSSO2G2 725.25 116336.0 NaN 572.537 0.4319 265.224 128402.000 1251483.675 4 SERC Tangentially-fired Coal

In [10]:
emissions.tail()


Out[10]:
State Facility Name Facility ID (ORISPL) Unit ID Associated Stacks Month Year Program(s) Operating Time Gross Load (MW-h) Steam Load (1000lb) SO2 (tons) Avg. NOx Rate (lb/MMBtu) NOx (tons) CO2 (short tons) Heat Input (MMBtu) EPA Region NERC Region Unit Type Fuel Type (Primary)
3919 WY Neil Simpson II (CT2) 55477 CT2 NaN 5 2016 ARP 2.16 69.00 NaN 0.000 0.0485 0.020 39.911 672.960 8 NaN Combustion turbine Pipeline Natural Gas
3920 WY Wygen I 55479 001 NaN 5 2016 ARP, MATS 662.62 58852.88 NaN 24.672 0.1298 43.135 68889.530 656851.004 8 NaN Dry bottom wall-fired boiler Coal
3921 WY Wygen II 56319 001 NaN 5 2016 ARP, MATS 744.00 69215.00 NaN 17.378 0.0534 20.303 79420.900 757259.300 8 WECC Dry bottom wall-fired boiler Coal
3922 WY Wygen III 56596 001 NaN 5 2016 ARP, MATS 581.64 62642.20 NaN 16.041 0.0481 12.642 67689.944 645401.544 8 WECC Dry bottom wall-fired boiler Coal
3923 WY Wyodak 6101 BW91 NaN 5 2016 ARP, MATS 0.00 NaN NaN NaN NaN NaN NaN NaN 8 WECC Dry bottom wall-fired boiler Coal

Accessing parts of the dataframe


In [11]:
emissions.columns


Out[11]:
Index([u'State', u' Facility Name', u' Facility ID (ORISPL)', u' Unit ID',
       u' Associated Stacks', u' Month', u' Year', u' Program(s)',
       u' Operating Time', u' Gross Load (MW-h)', u' Steam Load (1000lb)',
       u' SO2 (tons)', u' Avg. NOx Rate (lb/MMBtu)', u' NOx (tons)',
       u' CO2 (short tons)', u' Heat Input (MMBtu)', u' EPA Region',
       u' NERC Region', u' Unit Type', u' Fuel Type (Primary)'],
      dtype='object')

In [13]:
emissions.columns = [name.strip() for name in emissions.columns]
emissions.columns


Out[13]:
Index([u'State', u'Facility Name', u'Facility ID (ORISPL)', u'Unit ID',
       u'Associated Stacks', u'Month', u'Year', u'Program(s)',
       u'Operating Time', u'Gross Load (MW-h)', u'Steam Load (1000lb)',
       u'SO2 (tons)', u'Avg. NOx Rate (lb/MMBtu)', u'NOx (tons)',
       u'CO2 (short tons)', u'Heat Input (MMBtu)', u'EPA Region',
       u'NERC Region', u'Unit Type', u'Fuel Type (Primary)'],
      dtype='object')

In [14]:
emissions.dtypes


Out[14]:
State                        object
Facility Name                object
Facility ID (ORISPL)          int64
Unit ID                      object
Associated Stacks            object
Month                         int64
Year                          int64
Program(s)                   object
Operating Time              float64
Gross Load (MW-h)           float64
Steam Load (1000lb)         float64
SO2 (tons)                  float64
Avg. NOx Rate (lb/MMBtu)    float64
NOx (tons)                  float64
CO2 (short tons)            float64
Heat Input (MMBtu)          float64
EPA Region                    int64
NERC Region                  object
Unit Type                    object
Fuel Type (Primary)          object
dtype: object

In [15]:
type(emissions)


Out[15]:
pandas.core.frame.DataFrame

In [16]:
type(emissions['Operating Time'])


Out[16]:
pandas.core.series.Series

In [21]:
df = emissions.loc[:5,'Operating Time']

In [22]:
df


Out[22]:
0     28.00
1     17.00
2      2.75
3      2.75
4    725.25
5    588.00
Name: Operating Time, dtype: float64

In [23]:
emissions.iloc[:5,:3]


Out[23]:
State Facility Name Facility ID (ORISPL)
0 AL AMEA Sylacauga Plant 56018
1 AL AMEA Sylacauga Plant 56018
2 AL Barry 3
3 AL Barry 3
4 AL Barry 3

In [26]:
emissions.loc[:5,:'Operating Time']


Out[26]:
State Facility Name Facility ID (ORISPL) Unit ID Associated Stacks Month Year Program(s) Operating Time
0 AL AMEA Sylacauga Plant 56018 1 NaN 5 2016 CSNOX, CSNOXOS, CSSO2G2, ARP 28.00
1 AL AMEA Sylacauga Plant 56018 2 NaN 5 2016 CSNOX, CSNOXOS, CSSO2G2, ARP 17.00
2 AL Barry 3 1 CS0AAN 5 2016 ARP, CSNOX, CSNOXOS, CSSO2G2 2.75
3 AL Barry 3 2 CS0AAN 5 2016 ARP, CSNOX, CSNOXOS, CSSO2G2 2.75
4 AL Barry 3 4 NaN 5 2016 ARP, MATS, CSNOX, CSNOXOS, CSSO2G2 725.25
5 AL Barry 3 5 MS5C, MS5D, MS5E 5 2016 ARP, MATS, CSNOX, CSNOXOS, CSSO2G2 588.00

In [32]:
emissions.iloc[:5,3].sum()


Out[32]:
'12124'

Sum unit emissions for each facility using groupby


In [33]:
emissions.groupby('Facility ID (ORISPL)')


Out[33]:
<pandas.core.groupby.DataFrameGroupBy object at 0x112cfdcd0>

In [34]:
facility_emiss = emissions.groupby('Facility ID (ORISPL)').sum()

In [35]:
facility_emiss


Out[35]:
Month Year Operating Time Gross Load (MW-h) Steam Load (1000lb) SO2 (tons) Avg. NOx Rate (lb/MMBtu) NOx (tons) CO2 (short tons) Heat Input (MMBtu) EPA Region
Facility ID (ORISPL)
3 40 16128 3844.00 1048450.25 NaN 595.911 0.5760 411.165 677078.976 8471790.125 32
7 10 4032 924.00 NaN 222159.75 0.990 0.2067 13.814 15771.300 266053.425 8
8 15 6048 1837.25 505777.25 NaN 125.662 0.5375 440.348 531418.603 5179513.525 12
9 5 2016 20.60 541.68 NaN 0.003 0.2751 1.504 NaN 10441.833 6
10 55 22176 188.25 8897.75 NaN 48.579 0.8474 10.162 11340.124 144258.150 44
26 25 10080 744.00 495791.00 NaN 173.698 0.0646 165.370 524604.900 5113099.400 20
47 65 26208 20.00 177.00 NaN 0.333 4.4379 0.722 192.400 2765.600 52
50 10 4032 0.00 NaN NaN NaN NaN NaN NaN NaN 8
51 5 2016 553.48 262392.63 NaN 1081.656 0.2080 241.863 270128.775 2481213.560 6
54 45 18144 254.45 15652.65 NaN 0.057 0.3753 2.787 11101.898 186799.693 36
56 15 6048 759.23 112793.47 NaN 63.902 0.5125 167.878 129301.129 1260257.488 12
59 5 2016 321.07 18822.00 NaN 16.264 0.2297 24.957 21946.742 209245.816 7
60 10 4032 753.95 36111.00 NaN 176.503 0.2169 39.165 44877.292 427905.242 14
87 5 2016 744.00 82439.00 NaN 34.069 0.3811 161.168 88806.200 846735.000 6
108 5 2016 660.18 160882.24 NaN 95.013 0.1813 151.412 173507.748 1654354.527 7
113 15 6048 992.93 120001.76 NaN 57.635 0.6462 149.985 135364.206 1319344.965 27
116 10 4032 247.40 8653.84 NaN 0.032 0.2216 7.130 6368.940 107186.519 18
117 15 6048 623.34 109950.39 NaN 0.257 0.0754 7.739 50958.633 857449.725 27
118 5 2016 37.80 1491.10 NaN 0.007 0.0507 0.447 1333.907 22445.386 9
120 15 6048 748.53 35334.66 NaN 0.120 0.1839 26.270 23956.571 403122.659 27
124 5 2016 7.70 360.90 NaN 0.009 0.0468 0.081 298.620 5024.270 9
126 20 8064 1101.56 76803.54 NaN 2.119 0.5604 69.574 50133.139 822072.677 36
127 5 2016 401.58 129794.52 NaN 73.983 0.2907 203.293 145337.271 1385756.804 6
130 20 8064 1518.03 822856.12 NaN 370.759 0.2077 289.871 860955.931 8391402.264 16
136 10 4032 1451.60 689645.88 NaN 477.829 0.1152 187.062 682395.436 6651035.344 8
141 15 6048 67.49 4296.61 NaN 0.014 0.5300 11.359 2730.960 45960.324 27
147 5 2016 611.23 130042.08 NaN 0.277 0.0101 3.965 54824.884 922519.859 9
160 20 8064 1970.04 185441.25 NaN 20.620 1.0331 359.939 185387.782 1905952.909 36
165 10 4032 603.34 191538.88 NaN 506.266 0.2807 170.876 239423.987 2290169.297 12
170 5 2016 638.74 139956.89 NaN 0.422 0.2584 239.594 83529.374 1405547.366 6
... ... ... ... ... ... ... ... ... ... ... ...
57037 10 4032 1398.25 368847.25 NaN 0.850 0.0271 17.634 168415.150 2833845.350 8
57073 5 2016 0.00 NaN NaN NaN NaN NaN NaN NaN 9
57074 5 2016 407.00 NaN NaN 0.015 0.0110 0.298 3187.900 54046.000 9
57075 5 2016 248.00 NaN NaN 0.007 0.0110 0.149 1602.200 27151.000 9
57241 5 2016 42.34 2051.00 NaN 0.090 0.0555 1.154 3480.042 33986.189 4
57267 20 8064 18.74 2488.57 NaN 0.008 0.0434 0.123 1712.645 28817.647 36
57349 5 2016 393.61 100963.68 NaN 0.207 0.0089 2.387 40922.021 688589.496 3
57482 40 16128 451.97 29914.41 NaN 0.088 0.1731 2.092 17568.752 295618.850 72
57483 20 8064 345.92 10334.14 NaN 0.036 0.0692 0.712 6236.594 104945.273 36
57515 25 10080 823.60 65754.07 NaN 0.174 0.1513 5.561 34605.858 582304.228 45
57703 15 6048 733.14 19706.25 NaN 0.060 0.0540 0.859 12035.438 202527.156 24
57839 10 4032 1101.30 357284.80 NaN 0.639 0.0110 5.838 126516.225 2128891.010 4
57865 15 6048 81.55 10928.02 NaN 0.034 0.1633 2.704 6779.163 114074.151 18
57881 15 6048 580.92 20205.20 NaN 0.062 0.0855 1.784 12307.201 207098.166 24
57943 15 6048 1753.37 60954.81 NaN 0.183 0.0481 3.916 36090.079 607288.728 24
57978 5 2016 16.81 2461.69 NaN 0.008 0.0201 0.119 1625.035 27347.542 9
58001 20 8064 1485.62 417253.89 NaN 0.935 0.0426 12.778 185161.751 3115749.902 24
58005 10 4032 994.60 292270.75 NaN 0.644 0.0166 7.113 127678.269 2148462.119 12
58054 5 2016 743.03 53385.00 NaN 1.455 0.0584 19.356 69154.702 664207.371 1
58079 10 4032 1268.00 385188.46 NaN 0.756 0.0128 7.746 149796.191 2520589.201 4
58122 5 2016 2.57 61.56 NaN 0.000 0.0775 0.048 43.560 732.625 9
58235 5 2016 119.55 7160.00 NaN 0.020 0.0191 0.384 3909.089 65770.895 2
58260 15 6048 1824.11 705418.26 NaN 1.468 0.0321 17.479 290920.901 4895295.214 9
58284 5 2016 16.62 483.78 NaN 0.001 0.0250 0.032 289.595 4874.589 6
58325 5 2016 7.93 471.64 NaN 0.002 0.0457 0.147 390.728 6576.714 6
58471 10 4032 81.30 8786.34 NaN 0.142 0.1028 1.593 6244.180 105066.232 12
58478 5 2016 47.25 1823.50 NaN 0.005 0.0215 0.148 968.200 16293.125 6
58562 10 4032 615.09 40172.06 NaN 0.111 0.0296 2.077 21929.390 368989.001 12
59926 10 4032 24.63 2794.92 NaN 0.015 0.0320 0.806 2972.500 50368.700 10
70454 10 4032 62.78 7178.74 NaN 0.026 0.1711 3.388 5164.599 86899.023 8

1208 rows × 11 columns

Use apply to apply a function to every row of a dataframe


In [38]:
def correct_region(row):
    num_units = row['Month'] / 5
    region = row['EPA Region'] / num_units
    return int(region)

In [39]:
facility_emiss.apply(correct_region, axis=1)


Out[39]:
Facility ID (ORISPL)
3        4
7        4
8        4
9        6
10       4
26       4
47       4
50       4
51       6
54       4
56       4
59       7
60       7
87       6
108      7
113      9
116      9
117      9
118      9
120      9
124      9
126      9
127      6
130      4
136      4
141      9
147      9
160      9
165      6
170      6
        ..
57037    4
57073    9
57074    9
57075    9
57241    4
57267    9
57349    3
57482    9
57483    9
57515    9
57703    8
57839    2
57865    6
57881    8
57943    8
57978    9
58001    6
58005    6
58054    1
58079    2
58122    9
58235    2
58260    3
58284    6
58325    6
58471    6
58478    6
58562    6
59926    5
70454    4
dtype: int64

In [40]:
facility_emiss.loc[:,'EPA Region'] = facility_emiss.apply(correct_region, axis=1)
facility_emiss = facility_emiss.iloc[:,2:]
facility_emiss


Out[40]:
Operating Time Gross Load (MW-h) Steam Load (1000lb) SO2 (tons) Avg. NOx Rate (lb/MMBtu) NOx (tons) CO2 (short tons) Heat Input (MMBtu) EPA Region
Facility ID (ORISPL)
3 3844.00 1048450.25 NaN 595.911 0.5760 411.165 677078.976 8471790.125 4
7 924.00 NaN 222159.75 0.990 0.2067 13.814 15771.300 266053.425 4
8 1837.25 505777.25 NaN 125.662 0.5375 440.348 531418.603 5179513.525 4
9 20.60 541.68 NaN 0.003 0.2751 1.504 NaN 10441.833 6
10 188.25 8897.75 NaN 48.579 0.8474 10.162 11340.124 144258.150 4
26 744.00 495791.00 NaN 173.698 0.0646 165.370 524604.900 5113099.400 4
47 20.00 177.00 NaN 0.333 4.4379 0.722 192.400 2765.600 4
50 0.00 NaN NaN NaN NaN NaN NaN NaN 4
51 553.48 262392.63 NaN 1081.656 0.2080 241.863 270128.775 2481213.560 6
54 254.45 15652.65 NaN 0.057 0.3753 2.787 11101.898 186799.693 4
56 759.23 112793.47 NaN 63.902 0.5125 167.878 129301.129 1260257.488 4
59 321.07 18822.00 NaN 16.264 0.2297 24.957 21946.742 209245.816 7
60 753.95 36111.00 NaN 176.503 0.2169 39.165 44877.292 427905.242 7
87 744.00 82439.00 NaN 34.069 0.3811 161.168 88806.200 846735.000 6
108 660.18 160882.24 NaN 95.013 0.1813 151.412 173507.748 1654354.527 7
113 992.93 120001.76 NaN 57.635 0.6462 149.985 135364.206 1319344.965 9
116 247.40 8653.84 NaN 0.032 0.2216 7.130 6368.940 107186.519 9
117 623.34 109950.39 NaN 0.257 0.0754 7.739 50958.633 857449.725 9
118 37.80 1491.10 NaN 0.007 0.0507 0.447 1333.907 22445.386 9
120 748.53 35334.66 NaN 0.120 0.1839 26.270 23956.571 403122.659 9
124 7.70 360.90 NaN 0.009 0.0468 0.081 298.620 5024.270 9
126 1101.56 76803.54 NaN 2.119 0.5604 69.574 50133.139 822072.677 9
127 401.58 129794.52 NaN 73.983 0.2907 203.293 145337.271 1385756.804 6
130 1518.03 822856.12 NaN 370.759 0.2077 289.871 860955.931 8391402.264 4
136 1451.60 689645.88 NaN 477.829 0.1152 187.062 682395.436 6651035.344 4
141 67.49 4296.61 NaN 0.014 0.5300 11.359 2730.960 45960.324 9
147 611.23 130042.08 NaN 0.277 0.0101 3.965 54824.884 922519.859 9
160 1970.04 185441.25 NaN 20.620 1.0331 359.939 185387.782 1905952.909 9
165 603.34 191538.88 NaN 506.266 0.2807 170.876 239423.987 2290169.297 6
170 638.74 139956.89 NaN 0.422 0.2584 239.594 83529.374 1405547.366 6
... ... ... ... ... ... ... ... ... ...
57037 1398.25 368847.25 NaN 0.850 0.0271 17.634 168415.150 2833845.350 4
57073 0.00 NaN NaN NaN NaN NaN NaN NaN 9
57074 407.00 NaN NaN 0.015 0.0110 0.298 3187.900 54046.000 9
57075 248.00 NaN NaN 0.007 0.0110 0.149 1602.200 27151.000 9
57241 42.34 2051.00 NaN 0.090 0.0555 1.154 3480.042 33986.189 4
57267 18.74 2488.57 NaN 0.008 0.0434 0.123 1712.645 28817.647 9
57349 393.61 100963.68 NaN 0.207 0.0089 2.387 40922.021 688589.496 3
57482 451.97 29914.41 NaN 0.088 0.1731 2.092 17568.752 295618.850 9
57483 345.92 10334.14 NaN 0.036 0.0692 0.712 6236.594 104945.273 9
57515 823.60 65754.07 NaN 0.174 0.1513 5.561 34605.858 582304.228 9
57703 733.14 19706.25 NaN 0.060 0.0540 0.859 12035.438 202527.156 8
57839 1101.30 357284.80 NaN 0.639 0.0110 5.838 126516.225 2128891.010 2
57865 81.55 10928.02 NaN 0.034 0.1633 2.704 6779.163 114074.151 6
57881 580.92 20205.20 NaN 0.062 0.0855 1.784 12307.201 207098.166 8
57943 1753.37 60954.81 NaN 0.183 0.0481 3.916 36090.079 607288.728 8
57978 16.81 2461.69 NaN 0.008 0.0201 0.119 1625.035 27347.542 9
58001 1485.62 417253.89 NaN 0.935 0.0426 12.778 185161.751 3115749.902 6
58005 994.60 292270.75 NaN 0.644 0.0166 7.113 127678.269 2148462.119 6
58054 743.03 53385.00 NaN 1.455 0.0584 19.356 69154.702 664207.371 1
58079 1268.00 385188.46 NaN 0.756 0.0128 7.746 149796.191 2520589.201 2
58122 2.57 61.56 NaN 0.000 0.0775 0.048 43.560 732.625 9
58235 119.55 7160.00 NaN 0.020 0.0191 0.384 3909.089 65770.895 2
58260 1824.11 705418.26 NaN 1.468 0.0321 17.479 290920.901 4895295.214 3
58284 16.62 483.78 NaN 0.001 0.0250 0.032 289.595 4874.589 6
58325 7.93 471.64 NaN 0.002 0.0457 0.147 390.728 6576.714 6
58471 81.30 8786.34 NaN 0.142 0.1028 1.593 6244.180 105066.232 6
58478 47.25 1823.50 NaN 0.005 0.0215 0.148 968.200 16293.125 6
58562 615.09 40172.06 NaN 0.111 0.0296 2.077 21929.390 368989.001 6
59926 24.63 2794.92 NaN 0.015 0.0320 0.806 2972.500 50368.700 5
70454 62.78 7178.74 NaN 0.026 0.1711 3.388 5164.599 86899.023 4

1208 rows × 9 columns

Load Capacity data


In [41]:
capacity = pd.read_excel(fn2, sheetname='Operating', header=1)

In [42]:
capacity.head()


Out[42]:
Entity ID Entity Name Plant ID Plant Name Sector Plant State Generator ID Nameplate Capacity (MW) Net Summer Capacity (MW) Technology ... Status Planned Derate Year Planned Derate Month Planned Derate of Summer Capacity (MW) Planned Uprate Year Planned Uprate Month Planned Uprate of Summer Capacity (MW) County Latitude Longitude
0 195 Alabama Power Co 2.0 Bankhead Dam Electric Utility AL 1 53.9 56 Conventional Hydroelectric ... (OP) Operating Tuscaloosa 33.4587 -87.3568
1 195 Alabama Power Co 3.0 Barry Electric Utility AL 1 153.1 55 Natural Gas Steam Turbine ... (OP) Operating Mobile 31.0069 -88.0103
2 195 Alabama Power Co 3.0 Barry Electric Utility AL 2 153.1 55 Natural Gas Steam Turbine ... (OP) Operating Mobile 31.0069 -88.0103
3 195 Alabama Power Co 3.0 Barry Electric Utility AL 4 403.7 362 Conventional Steam Coal ... (OP) Operating Mobile 31.0069 -88.0103
4 195 Alabama Power Co 3.0 Barry Electric Utility AL 5 788.8 726.5 Conventional Steam Coal ... (OP) Operating Mobile 31.0069 -88.0103

5 rows × 26 columns


In [43]:
capacity.tail()


Out[43]:
Entity ID Entity Name Plant ID Plant Name Sector Plant State Generator ID Nameplate Capacity (MW) Net Summer Capacity (MW) Technology ... Status Planned Derate Year Planned Derate Month Planned Derate of Summer Capacity (MW) Planned Uprate Year Planned Uprate Month Planned Uprate of Summer Capacity (MW) County Latitude Longitude
20183 60205 Currin Solar, LLC 60403.0 Currin Solar, LLC IPP Non-CHP NC CSPV 5.2 5.2 Solar Photovoltaic ... (OP) Operating Granville 36.2896 -78.6333
20184 60163 Soltage LLC 60411.0 Coventry Photovoltaic, LLC IPP Non-CHP VT COVEN 2.2 2.2 Solar Photovoltaic ... (OP) Operating Orleans 44.9102 -72.2198
20185 60227 ORNI 37 LLC 60419.0 Don A Campbell 2 Geothermal IPP Non-CHP NV DAC2G 25.0 16.2 Geothermal ... (OP) Operating Mineral 38.8358 -118.325
20186 57081 WGL Energy Systems, Inc 60425.0 Skidmore College IPP Non-CHP NY SO049 2.0 2 Solar Photovoltaic ... (OP) Operating Saratoga 43.0937 -73.8113
20187 NOTES:\nCapacity from facilities with a total ... NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

5 rows × 26 columns


In [44]:
capacity.drop(20187, inplace=True)

In [45]:
capacity.loc[:,'Plant ID'] = capacity.loc[:,'Plant ID'].astype(int)

In [46]:
capacity.head()


Out[46]:
Entity ID Entity Name Plant ID Plant Name Sector Plant State Generator ID Nameplate Capacity (MW) Net Summer Capacity (MW) Technology ... Status Planned Derate Year Planned Derate Month Planned Derate of Summer Capacity (MW) Planned Uprate Year Planned Uprate Month Planned Uprate of Summer Capacity (MW) County Latitude Longitude
0 195 Alabama Power Co 2 Bankhead Dam Electric Utility AL 1 53.9 56 Conventional Hydroelectric ... (OP) Operating Tuscaloosa 33.4587 -87.3568
1 195 Alabama Power Co 3 Barry Electric Utility AL 1 153.1 55 Natural Gas Steam Turbine ... (OP) Operating Mobile 31.0069 -88.0103
2 195 Alabama Power Co 3 Barry Electric Utility AL 2 153.1 55 Natural Gas Steam Turbine ... (OP) Operating Mobile 31.0069 -88.0103
3 195 Alabama Power Co 3 Barry Electric Utility AL 4 403.7 362 Conventional Steam Coal ... (OP) Operating Mobile 31.0069 -88.0103
4 195 Alabama Power Co 3 Barry Electric Utility AL 5 788.8 726.5 Conventional Steam Coal ... (OP) Operating Mobile 31.0069 -88.0103

5 rows × 26 columns

Check the column names


In [47]:
capacity.columns


Out[47]:
Index([u'Entity ID', u'Entity Name', u'Plant ID', u'Plant Name', u'Sector',
       u'Plant State', u'Generator ID', u'\nNameplate Capacity (MW)',
       u'\n \nNet Summer Capacity (MW)', u'Technology', u'Energy Source Code',
       u'Prime Mover Code', u'Operating Month', u'Operating Year',
       u'Planned Retirement Month', u'Planned Retirement Year', u'Status',
       u'Planned Derate Year', u'Planned Derate Month',
       u'Planned Derate of Summer Capacity (MW)', u'Planned Uprate Year',
       u'Planned Uprate Month', u'Planned Uprate of Summer Capacity (MW)',
       u'County', u'Latitude', u'Longitude'],
      dtype='object')

In [50]:
capacity.columns = [name.strip() for name in capacity.columns]

In [51]:
capacity.columns


Out[51]:
Index([u'Entity ID', u'Entity Name', u'Plant ID', u'Plant Name', u'Sector',
       u'Plant State', u'Generator ID', u'Nameplate Capacity (MW)',
       u'Net Summer Capacity (MW)', u'Technology', u'Energy Source Code',
       u'Prime Mover Code', u'Operating Month', u'Operating Year',
       u'Planned Retirement Month', u'Planned Retirement Year', u'Status',
       u'Planned Derate Year', u'Planned Derate Month',
       u'Planned Derate of Summer Capacity (MW)', u'Planned Uprate Year',
       u'Planned Uprate Month', u'Planned Uprate of Summer Capacity (MW)',
       u'County', u'Latitude', u'Longitude'],
      dtype='object')

In [53]:
'ID' in 'Entity ID'


Out[53]:
True

Boolean filtering


In [54]:
capacity['Plant State'] == 'PA'


Out[54]:
0        False
1        False
2        False
3        False
4        False
5        False
6        False
7        False
8        False
9        False
10       False
11       False
12       False
13       False
14       False
15       False
16       False
17       False
18       False
19       False
20       False
21       False
22       False
23       False
24       False
25       False
26       False
27       False
28       False
29       False
         ...  
20157    False
20158    False
20159    False
20160    False
20161    False
20162    False
20163    False
20164    False
20165    False
20166    False
20167    False
20168    False
20169    False
20170    False
20171    False
20172    False
20173    False
20174    False
20175    False
20176    False
20177    False
20178    False
20179    False
20180     True
20181    False
20182    False
20183    False
20184    False
20185    False
20186    False
Name: Plant State, dtype: bool

In [55]:
PA_cap = capacity.loc[capacity['Plant State'] == 'PA',:]
PA_cap


Out[55]:
Entity ID Entity Name Plant ID Plant Name Sector Plant State Generator ID Nameplate Capacity (MW) Net Summer Capacity (MW) Technology ... Status Planned Derate Year Planned Derate Month Planned Derate of Summer Capacity (MW) Planned Uprate Year Planned Uprate Month Planned Uprate of Summer Capacity (MW) County Latitude Longitude
5223 14165 NRG Power Midwest LP 3096 Brunot Island IPP Non-CHP PA 1A 25.5 15 Petroleum Liquids ... (OP) Operating Allegheny 40.4649 -80.0438
5224 14165 NRG Power Midwest LP 3096 Brunot Island IPP Non-CHP PA 2A 65.3 46 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.4649 -80.0438
5225 14165 NRG Power Midwest LP 3096 Brunot Island IPP Non-CHP PA 2B 65.3 48 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.4649 -80.0438
5226 14165 NRG Power Midwest LP 3096 Brunot Island IPP Non-CHP PA 3 65.3 49 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.4649 -80.0438
5227 14165 NRG Power Midwest LP 3096 Brunot Island IPP Non-CHP PA ST4 144.0 101 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.4649 -80.0438
5228 17235 NRG REMA LLC 3109 Hamilton (PA) IPP Non-CHP PA 1 19.6 18 Petroleum Liquids ... (OP) Operating Adams 39.9087 -76.9885
5229 17235 NRG REMA LLC 3110 Hunterstown IPP Non-CHP PA 1 20.0 18 Petroleum Liquids ... (OP) Operating Adams 39.8662 -77.1648
5230 17235 NRG REMA LLC 3110 Hunterstown IPP Non-CHP PA 2 20.0 17 Petroleum Liquids ... (OP) Operating Adams 39.8662 -77.1648
5231 17235 NRG REMA LLC 3110 Hunterstown IPP Non-CHP PA 3 20.0 18 Petroleum Liquids ... (OP) Operating Adams 39.8662 -77.1648
5232 17235 NRG REMA LLC 3111 Mountain IPP Non-CHP PA 1 27.0 18 Petroleum Liquids ... (OP) Operating Cumberland 40.1229 -77.1723
5233 17235 NRG REMA LLC 3111 Mountain IPP Non-CHP PA 2 27.0 18 Petroleum Liquids ... (OP) Operating Cumberland 40.1229 -77.1723
5234 17235 NRG REMA LLC 3112 Orrtanna IPP Non-CHP PA 1 27.0 18 Petroleum Liquids ... (OP) Operating Adams 39.8442 -77.3508
5235 17235 NRG REMA LLC 3113 Portland (PA) IPP Non-CHP PA 3 18.0 13 Petroleum Liquids ... (OP) Operating Northampton 40.9102 -75.0794
5236 17235 NRG REMA LLC 3113 Portland (PA) IPP Non-CHP PA 4 20.0 17 Petroleum Liquids ... (OP) Operating Northampton 40.9102 -75.0794
5237 17235 NRG REMA LLC 3113 Portland (PA) IPP Non-CHP PA 5 156.0 134 Petroleum Liquids ... (OP) Operating Northampton 40.9102 -75.0794
5238 17235 NRG REMA LLC 3114 Shawnee (PA) IPP Non-CHP PA 1 20.0 17 Petroleum Liquids ... (OP) Operating Monroe 41.0612 -75.0582
5239 17235 NRG REMA LLC 3115 Titus IPP Non-CHP PA 4 18.0 13 Petroleum Liquids ... (OP) Operating Berks 40.3056 -75.9081
5240 17235 NRG REMA LLC 3115 Titus IPP Non-CHP PA 5 18.0 14 Petroleum Liquids ... (OP) Operating Berks 40.3056 -75.9081
5241 17235 NRG REMA LLC 3116 Tolna IPP Non-CHP PA 1 27.0 18 Petroleum Liquids ... (SB) Standby/Backup: available for service but... York 39.7606 -76.6353
5242 17235 NRG REMA LLC 3116 Tolna IPP Non-CHP PA 2 27.0 18 Petroleum Liquids ... (SB) Standby/Backup: available for service but... York 39.7606 -76.6353
5243 56065 York Haven Power Company LLC 3117 York Haven IPP Non-CHP PA 1 19.6 19 Conventional Hydroelectric ... (OP) Operating York 40.1136 -76.712
5244 15873 GenOn Northeast Management Company 3118 Conemaugh IPP Non-CHP PA 1 936.0 850 Conventional Steam Coal ... (OP) Operating Indiana 40.3842 -79.0611
5245 15873 GenOn Northeast Management Company 3118 Conemaugh IPP Non-CHP PA 2 936.0 850 Conventional Steam Coal ... (OP) Operating Indiana 40.3842 -79.0611
5246 15873 GenOn Northeast Management Company 3118 Conemaugh IPP Non-CHP PA A 3.0 2.8 Petroleum Liquids ... (SB) Standby/Backup: available for service but... Indiana 40.3842 -79.0611
5247 15873 GenOn Northeast Management Company 3118 Conemaugh IPP Non-CHP PA B 3.0 2.8 Petroleum Liquids ... (SB) Standby/Backup: available for service but... Indiana 40.3842 -79.0611
5248 15873 GenOn Northeast Management Company 3118 Conemaugh IPP Non-CHP PA C 3.0 2.8 Petroleum Liquids ... (SB) Standby/Backup: available for service but... Indiana 40.3842 -79.0611
5249 15873 GenOn Northeast Management Company 3118 Conemaugh IPP Non-CHP PA D 3.0 2.8 Petroleum Liquids ... (SB) Standby/Backup: available for service but... Indiana 40.3842 -79.0611
5250 17235 NRG REMA LLC 3120 Blossburg IPP Non-CHP PA 1 24.0 16 Natural Gas Fired Combustion Turbine ... (OP) Operating Tioga 41.7065 -77.0818
5251 58615 NRG Homer City Services LLC 3122 Homer City Generating Station IPP Non-CHP PA 1 660.0 624.5 Conventional Steam Coal ... (OP) Operating Indiana 40.5128 -79.1961
5252 58615 NRG Homer City Services LLC 3122 Homer City Generating Station IPP Non-CHP PA 2 660.0 617.5 Conventional Steam Coal ... (OP) Operating Indiana 40.5128 -79.1961
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
18480 58438 Sunstream Energy LLC 58443 Martin Limestone Solar Array IPP Non-CHP PA GEN1 1.0 1 Solar Photovoltaic ... (OP) Operating Lancaster 40.1078 -76.0617
18526 58463 Dart Container Corp 58476 Dart Container Corp Industrial CHP PA LFGT1 5.6 4.6 Landfill Gas ... (OP) Operating Lancaster 40.0865 -76.176
18527 58463 Dart Container Corp 58476 Dart Container Corp Industrial CHP PA LFGT2 5.6 4.6 Landfill Gas ... (OP) Operating Lancaster 40.0865 -76.176
18549 7477 Granger Electric Co 58497 L&S Sweetners IPP Non-CHP PA GEN1 1.6 1.6 Landfill Gas ... (OP) Operating Lancaster 40.0906 -76.1456
18550 7477 Granger Electric Co 58497 L&S Sweetners IPP Non-CHP PA GEN2 1.6 1.6 Landfill Gas ... (OP) Operating Lancaster 40.0906 -76.1456
18598 56645 Aqua America Inc 58535 Pickering Solar IPP Non-CHP PA 1 1.5 1.4 Solar Photovoltaic ... (OP) Operating Chester 40.1206 -75.4881
18645 58527 Gettysburg Energy and Nutrient Rec Facility LLC 58565 Gettysburg Energy & Nutrient Rec Facility IPP Non-CHP PA GENRF 3.3 2.5 Other Waste Biomass ... (OP) Operating Adams 39.9503 -77.1253
18785 58617 Mahoning Creek Hydroelectric Company LLC 58685 Mahoning Creek Hydroelectric Project IPP Non-CHP PA 8107 6.0 6.7 Conventional Hydroelectric ... (OP) Operating Armstrong 40.9211 -79.2817
18818 58652 Roundtop Energy LLC 58715 Roundtop IPP Non-CHP PA GEN1 4.4 4.2 Natural Gas Internal Combustion Engine ... (OP) Operating Susquehanna 41.6578 -76.0492
18819 58652 Roundtop Energy LLC 58715 Roundtop IPP Non-CHP PA GEN2 4.4 4.2 Natural Gas Internal Combustion Engine ... (OP) Operating Susquehanna 41.6578 -76.0492
18820 58652 Roundtop Energy LLC 58715 Roundtop IPP Non-CHP PA GEN3 4.4 4.2 Natural Gas Internal Combustion Engine ... (OP) Operating Susquehanna 41.6578 -76.0492
18821 58652 Roundtop Energy LLC 58715 Roundtop IPP Non-CHP PA GEN4 4.4 4.2 Natural Gas Internal Combustion Engine ... (OP) Operating Susquehanna 41.6578 -76.0492
18822 58652 Roundtop Energy LLC 58715 Roundtop IPP Non-CHP PA GEN5 4.4 4.2 Natural Gas Internal Combustion Engine ... (OP) Operating Susquehanna 41.6578 -76.0492
19003 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G01 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19004 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G02 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19005 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G03 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19006 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G04 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19007 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G05 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19008 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G06 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19009 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G07 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19010 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G08 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19011 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G09 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19012 58767 Temple University 58897 Temple SEGF Commercial Non-CHP PA 19G10 1.6 1.6 Natural Gas Internal Combustion Engine ... (OP) Operating Philadelphia 39.98 -75.1506
19202 57130 Janssen Pharmaceutical Co 59056 Spring House IPP Non-CHP PA GEN 1 3.8 3.8 Natural Gas Internal Combustion Engine ... (OP) Operating Montgomery 40.1839 -75.2342
19435 59125 Marlboro Mushroom 59327 Marlboro Mushrooms Solar Field Industrial Non-CHP PA GEN1 1.0 1 Solar Photovoltaic ... (OP) Operating Chester 39.8828 -75.8294
19636 59287 Laurel Capital Partners 59546 Beaver Solar LLC IPP Non-CHP PA PV1 1.3 1.3 Solar Photovoltaic ... (OP) Operating Beaver 40.6914 -80.3239
19822 59526 State Correctnl Inst Laurel Highlands 59759 Glades Pike Generation Plant Commercial Non-CHP PA CAT1 1.6 1.4 Landfill Gas ... (OP) Operating Somerset 40.0067 -79.041
19823 59526 State Correctnl Inst Laurel Highlands 59759 Glades Pike Generation Plant Commercial Non-CHP PA CAT2 1.6 1.4 Landfill Gas ... (OP) Operating Somerset 40.0067 -79.041
19824 59526 State Correctnl Inst Laurel Highlands 59759 Glades Pike Generation Plant Commercial Non-CHP PA SOLAR 3.3 1.5 Landfill Gas ... (OP) Operating Somerset 40.0067 -79.041
20180 60187 Granger Energy of Morgantown 60388 Granger Energy of Morgantown IPP Non-CHP PA GEMT 1.6 1.6 Landfill Gas ... (OP) Operating Berks 40.1746 -75.9137

568 rows × 26 columns


In [56]:
capacity.loc[(capacity['Plant State'] == 'PA') &
             (capacity['Technology'] == 'Natural Gas Fired Combined Cycle'),:]


Out[56]:
Entity ID Entity Name Plant ID Plant Name Sector Plant State Generator ID Nameplate Capacity (MW) Net Summer Capacity (MW) Technology ... Status Planned Derate Year Planned Derate Month Planned Derate of Summer Capacity (MW) Planned Uprate Year Planned Uprate Month Planned Uprate of Summer Capacity (MW) County Latitude Longitude
5224 14165 NRG Power Midwest LP 3096 Brunot Island IPP Non-CHP PA 2A 65.3 46 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.4649 -80.0438
5225 14165 NRG Power Midwest LP 3096 Brunot Island IPP Non-CHP PA 2B 65.3 48 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.4649 -80.0438
5226 14165 NRG Power Midwest LP 3096 Brunot Island IPP Non-CHP PA 3 65.3 49 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.4649 -80.0438
5227 14165 NRG Power Midwest LP 3096 Brunot Island IPP Non-CHP PA ST4 144.0 101 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.4649 -80.0438
5381 19391 UGI Development Co 3176 Hunlock Power Station IPP Non-CHP PA 3 49.9 30.1 Natural Gas Fired Combined Cycle ... (OP) Operating Luzerne 41.2006 -76.07
5382 19391 UGI Development Co 3176 Hunlock Power Station IPP Non-CHP PA 5 48.0 48.7 Natural Gas Fired Combined Cycle ... (OP) Operating Luzerne 41.2006 -76.07
5383 19391 UGI Development Co 3176 Hunlock Power Station IPP Non-CHP PA 6 48.0 48.4 Natural Gas Fired Combined Cycle ... (OP) Operating Luzerne 41.2006 -76.07
11869 2468 Bucknell University 54333 Bucknell University Commercial CHP PA G001 4.7 4.3 Natural Gas Fired Combined Cycle ... (OP) Operating Union 40.955 -76.8788
11870 2468 Bucknell University 54333 Bucknell University Commercial CHP PA G502 1.2 0.5 Natural Gas Fired Combined Cycle ... (OP) Operating Union 40.955 -76.8788
12320 56516 Morris Energy Operations Company, LLC 54693 York Generation Company LLC IPP Non-CHP PA GT#1 8.3 46.2 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.9856 -76.6762
12321 56516 Morris Energy Operations Company, LLC 54693 York Generation Company LLC IPP Non-CHP PA GT#2 8.3 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.9856 -76.6762
12322 56516 Morris Energy Operations Company, LLC 54693 York Generation Company LLC IPP Non-CHP PA GT#5 8.3 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.9856 -76.6762
12323 56516 Morris Energy Operations Company, LLC 54693 York Generation Company LLC IPP Non-CHP PA GT#6 8.3 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.9856 -76.6762
12324 56516 Morris Energy Operations Company, LLC 54693 York Generation Company LLC IPP Non-CHP PA ST#1 9.5 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.9856 -76.6762
12325 56516 Morris Energy Operations Company, LLC 54693 York Generation Company LLC IPP Non-CHP PA ST#2 9.5 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.9856 -76.6762
12528 7564 Grays Ferry Cogen Partnership 54785 Grays Ferry Cogeneration IPP CHP PA GEN1 57.6 57 Natural Gas Fired Combined Cycle ... (OP) Operating Philadelphia 39.9422 -75.1881
12529 7564 Grays Ferry Cogen Partnership 54785 Grays Ferry Cogeneration IPP CHP PA GEN2 135.0 113 Natural Gas Fired Combined Cycle ... (OP) Operating Philadelphia 39.9422 -75.1881
13268 55649 Ontelaunee Energy Center 55193 Ontelaunee Energy Center IPP Non-CHP PA CTG1 250.0 180 Natural Gas Fired Combined Cycle ... (OP) Operating Berks 40.4219 -75.9356
13269 55649 Ontelaunee Energy Center 55193 Ontelaunee Energy Center IPP Non-CHP PA CTG2 250.0 180 Natural Gas Fired Combined Cycle ... (OP) Operating Berks 40.4219 -75.9356
13270 55649 Ontelaunee Energy Center 55193 Ontelaunee Energy Center IPP Non-CHP PA STG 228.0 180 Natural Gas Fired Combined Cycle ... (OP) Operating Berks 40.4219 -75.9356
13389 27031 Liberty Electric Power LLC 55231 Liberty Electric Power Plant IPP Non-CHP PA GTG1 186.0 158.6 Natural Gas Fired Combined Cycle ... (OP) Operating 2017 4 10.5 Delaware 39.8614 -75.3358
13390 27031 Liberty Electric Power LLC 55231 Liberty Electric Power Plant IPP Non-CHP PA GTG2 186.0 158.6 Natural Gas Fired Combined Cycle ... (OP) Operating 2016 10 10.5 Delaware 39.8614 -75.3358
13391 27031 Liberty Electric Power LLC 55231 Liberty Electric Power Plant IPP Non-CHP PA STG 242.0 223.8 Natural Gas Fired Combined Cycle ... (OP) Operating Delaware 39.8614 -75.3358
13604 54817 Fairless Energy LLC 55298 Fairless Energy Center IPP Non-CHP PA CT1A 198.9 189 Natural Gas Fired Combined Cycle ... (OP) Operating Bucks 40.1475 -74.7411
13605 54817 Fairless Energy LLC 55298 Fairless Energy Center IPP Non-CHP PA CT1B 198.9 189 Natural Gas Fired Combined Cycle ... (OP) Operating Bucks 40.1475 -74.7411
13606 54817 Fairless Energy LLC 55298 Fairless Energy Center IPP Non-CHP PA CT2A 198.9 189 Natural Gas Fired Combined Cycle ... (OP) Operating Bucks 40.1475 -74.7411
13607 54817 Fairless Energy LLC 55298 Fairless Energy Center IPP Non-CHP PA CT2B 198.9 189 Natural Gas Fired Combined Cycle ... (OP) Operating Bucks 40.1475 -74.7411
13608 54817 Fairless Energy LLC 55298 Fairless Energy Center IPP Non-CHP PA ST1 271.2 258 Natural Gas Fired Combined Cycle ... (OP) Operating Bucks 40.1475 -74.7411
13609 54817 Fairless Energy LLC 55298 Fairless Energy Center IPP Non-CHP PA ST2 271.2 258 Natural Gas Fired Combined Cycle ... (OP) Operating Bucks 40.1475 -74.7411
13674 58199 TalenEnergy Ironwood LLC 55337 TalenEnergy Ironwood LLC IPP Non-CHP PA CT1 259.2 218.7 Natural Gas Fired Combined Cycle ... (OP) Operating Lebanon 40.3509 -76.3658
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
13676 58199 TalenEnergy Ironwood LLC 55337 TalenEnergy Ironwood LLC IPP Non-CHP PA ST4 259.2 219.7 Natural Gas Fired Combined Cycle ... (OP) Operating Lebanon 40.3509 -76.3658
13964 59923 Dynegy Fayette Energy Facility 55516 Fayette Energy Facility IPP Non-CHP PA CTG1 163.5 174 Natural Gas Fired Combined Cycle ... (OP) Operating Fayette 39.8592 -79.9182
13965 59923 Dynegy Fayette Energy Facility 55516 Fayette Energy Facility IPP Non-CHP PA CTG2 163.5 174 Natural Gas Fired Combined Cycle ... (OP) Operating Fayette 39.8592 -79.9182
13966 59923 Dynegy Fayette Energy Facility 55516 Fayette Energy Facility IPP Non-CHP PA STG1 317.1 314 Natural Gas Fired Combined Cycle ... (OP) Operating Fayette 39.8592 -79.9182
13986 56608 Calpine Mid-Merit LLC 55524 York Energy Center IPP Non-CHP PA CTG1 120.0 113 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.7375 -76.3067
13987 56608 Calpine Mid-Merit LLC 55524 York Energy Center IPP Non-CHP PA CTG2 120.0 122 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.7375 -76.3067
13988 56608 Calpine Mid-Merit LLC 55524 York Energy Center IPP Non-CHP PA CTG3 120.0 122 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.7375 -76.3067
13989 56608 Calpine Mid-Merit LLC 55524 York Energy Center IPP Non-CHP PA STG1 200.0 188 Natural Gas Fired Combined Cycle ... (OP) Operating York 39.7375 -76.3067
14161 11275 Lower Mount Bethel Energy LLC 55667 Lower Mount Bethel Energy IPP Non-CHP PA G1 211.5 160.9 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.8019 -75.1076
14162 11275 Lower Mount Bethel Energy LLC 55667 Lower Mount Bethel Energy IPP Non-CHP PA G2 211.5 162.6 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.8019 -75.1076
14163 11275 Lower Mount Bethel Energy LLC 55667 Lower Mount Bethel Energy IPP Non-CHP PA G3 228.6 214 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.8019 -75.1076
14180 56607 Calpine Bethlehem LLC 55690 Bethlehem Power Plant IPP Non-CHP PA CTG1 127.0 118 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.6175 -75.3147
14181 56607 Calpine Bethlehem LLC 55690 Bethlehem Power Plant IPP Non-CHP PA CTG2 127.0 127 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.6175 -75.3147
14182 56607 Calpine Bethlehem LLC 55690 Bethlehem Power Plant IPP Non-CHP PA CTG3 127.0 127 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.6175 -75.3147
14183 56607 Calpine Bethlehem LLC 55690 Bethlehem Power Plant IPP Non-CHP PA CTG5 127.0 118 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.6175 -75.3147
14184 56607 Calpine Bethlehem LLC 55690 Bethlehem Power Plant IPP Non-CHP PA CTG6 127.0 127 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.6175 -75.3147
14185 56607 Calpine Bethlehem LLC 55690 Bethlehem Power Plant IPP Non-CHP PA CTG7 127.0 127 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.6175 -75.3147
14186 56607 Calpine Bethlehem LLC 55690 Bethlehem Power Plant IPP Non-CHP PA STG4 195.5 195 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.6175 -75.3147
14187 56607 Calpine Bethlehem LLC 55690 Bethlehem Power Plant IPP Non-CHP PA STG8 195.5 195 Natural Gas Fired Combined Cycle ... (OP) Operating Northampton 40.6175 -75.3147
14204 23279 Allegheny Energy Supply Co LLC 55710 FirstEnergy Allegheny Energy Units 3 4 & 5 IPP Non-CHP PA UNT3 184.0 167 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.5453 -79.7686
14205 23279 Allegheny Energy Supply Co LLC 55710 FirstEnergy Allegheny Energy Units 3 4 & 5 IPP Non-CHP PA UNT4 184.0 167 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.5453 -79.7686
14206 23279 Allegheny Energy Supply Co LLC 55710 FirstEnergy Allegheny Energy Units 3 4 & 5 IPP Non-CHP PA UNT5 188.0 175 Natural Gas Fired Combined Cycle ... (OP) Operating Allegheny 40.5453 -79.7686
14290 6693 FPL Energy Marcus Hook LP 55801 FPL Energy Marcus Hook LP IPP CHP PA CT13 188.2 172 Natural Gas Fired Combined Cycle ... (OP) Operating Delaware 39.807 -75.4216
14291 6693 FPL Energy Marcus Hook LP 55801 FPL Energy Marcus Hook LP IPP CHP PA CT1A 188.2 178.7 Natural Gas Fired Combined Cycle ... (OP) Operating Delaware 39.807 -75.4216
14292 6693 FPL Energy Marcus Hook LP 55801 FPL Energy Marcus Hook LP IPP CHP PA CTIB 188.2 172 Natural Gas Fired Combined Cycle ... (OP) Operating Delaware 39.807 -75.4216
14293 6693 FPL Energy Marcus Hook LP 55801 FPL Energy Marcus Hook LP IPP CHP PA STG 271.5 263 Natural Gas Fired Combined Cycle ... (OP) Operating Delaware 39.807 -75.4216
14433 54885 NRG Wholesale Generation LP 55976 Hunterstown Power Plant IPP Non-CHP PA 101 179.0 153 Natural Gas Fired Combined Cycle ... (OP) Operating Adams 39.8725 -77.1672
14434 54885 NRG Wholesale Generation LP 55976 Hunterstown Power Plant IPP Non-CHP PA 201 179.0 153 Natural Gas Fired Combined Cycle ... (OP) Operating Adams 39.8725 -77.1672
14435 54885 NRG Wholesale Generation LP 55976 Hunterstown Power Plant IPP Non-CHP PA 301 179.0 153 Natural Gas Fired Combined Cycle ... (OP) Operating Adams 39.8725 -77.1672
14436 54885 NRG Wholesale Generation LP 55976 Hunterstown Power Plant IPP Non-CHP PA 401 361.0 299 Natural Gas Fired Combined Cycle ... (OP) Operating Adams 39.8725 -77.1672

61 rows × 26 columns

Repeat groupby and sum to get capacity of facilities


In [57]:
cols = ['Plant ID', 'Nameplate Capacity (MW)']
facility_cap = capacity.loc[:,cols].groupby('Plant ID').sum()
facility_cap


Out[57]:
Nameplate Capacity (MW)
Plant ID
2 53.9
3 2569.5
4 225.0
7 138.0
8 1166.7
9 80.5
10 1288.4
11 72.9
12 46.9
13 100.0
14 128.1
15 177.0
16 210.6
17 170.0
18 181.0
19 91.0
20 87.6
21 50.5
26 2034.0
30 11.8
34 12.1
38 101.1
46 3494.0
47 1026.0
48 115.2
49 404.0
50 575.0
51 720.7
53 3.0
54 1055.0
... ...
60262 73.4
60263 1.6
60265 4.4
60267 2.7
60275 2.0
60276 4.1
60277 1.5
60278 1.9
60299 7.0
60312 4.9
60313 4.9
60314 35.8
60320 1.2
60321 16.1
60327 1.8
60341 1.0
60344 2.0
60349 2.3
60353 2.0
60365 1.6
60367 5.2
60369 5.2
60384 5.0
60388 1.6
60390 31.5
60401 5.2
60403 5.2
60411 2.2
60419 25.0
60425 2.0

7561 rows × 1 columns

Load generation data


In [60]:
generation = pd.read_excel(fn3, header=5)

In [61]:
generation.describe()


Out[61]:
Plant Id Nuclear Unit Id Operator Id Reserved NAICS Code EIA Sector Number Reserved.1 Reserved.2 Total Fuel Consumption Quantity Electric Fuel Consumption Quantity Total Fuel Consumption MMBtu Elec Fuel Consumption MMBtu Net Generation (Megawatthours) YEAR
count 6846.000000 100.000000 6846.000000 0.0 6846.000000 6846.000000 0.0 0.0 6.846000e+03 6.846000e+03 6.846000e+03 6.846000e+03 6.846000e+03 6846.0
mean 47395.247590 1.590000 45494.412650 NaN 38365.911043 2.550394 NaN NaN 1.735993e+06 1.523509e+06 5.046923e+06 4.736994e+06 5.018362e+05 2016.0
std 39659.073362 0.697687 38449.729044 NaN 68095.379303 2.051354 NaN NaN 6.397009e+06 5.648343e+06 1.423608e+07 1.412352e+07 1.379263e+06 0.0
min 3.000000 1.000000 21.000000 NaN 22.000000 1.000000 NaN NaN 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 -7.028300e+05 2016.0
25% 6001.250000 1.000000 12492.000000 NaN 22.000000 1.000000 NaN NaN 0.000000e+00 0.000000e+00 6.762500e+02 4.747500e+02 1.809423e+02 2016.0
50% 55061.000000 1.000000 22129.000000 NaN 22.000000 2.000000 NaN NaN 2.378500e+03 1.470500e+03 3.173170e+05 2.088960e+05 3.127657e+04 2016.0
75% 99999.000000 2.000000 99999.000000 NaN 99999.000000 3.000000 NaN NaN 4.469722e+05 2.983672e+05 2.892082e+06 2.288356e+06 2.921652e+05 2016.0
max 99999.000000 4.000000 99999.000000 NaN 562213.000000 7.000000 NaN NaN 1.533434e+08 1.208176e+08 1.505038e+08 1.505038e+08 1.544404e+07 2016.0

In [62]:
generation.head()


Out[62]:
Plant Id Combined Heat And Power Plant Nuclear Unit Id Plant Name Operator Name Operator Id Plant State Census Region NERC Region Reserved ... Netgen September Netgen October Netgen November Netgen December Total Fuel Consumption Quantity Electric Fuel Consumption Quantity Total Fuel Consumption MMBtu Elec Fuel Consumption MMBtu Net Generation (Megawatthours) YEAR
0 3 N NaN Barry Alabama Power Co 195 AL ESC SERC NaN ... 251839 219263 . . 4782719 4782719 4877614 4877614 2386339.000 2016
1 3 N NaN Barry Alabama Power Co 195 AL ESC SERC NaN ... 463646 401506 . . 42413079 42413079 43208127 43208127 4486082.000 2016
2 3 N NaN Barry Alabama Power Co 195 AL ESC SERC NaN ... 473794 286736 . . 1773704 1773704 37426485 37426485 3706973.300 2016
3 3 N NaN Barry Alabama Power Co 195 AL ESC SERC NaN ... 11246.3 14387.7 . . 857741 857741 874585 874585 86059.704 2016
4 4 N NaN Walter Bouldin Dam Alabama Power Co 195 AL ESC SERC NaN ... 3380 884 . . 0 0 4239930 4239930 454977.000 2016

5 rows × 97 columns


In [63]:
generation.tail()


Out[63]:
Plant Id Combined Heat And Power Plant Nuclear Unit Id Plant Name Operator Name Operator Id Plant State Census Region NERC Region Reserved ... Netgen September Netgen October Netgen November Netgen December Total Fuel Consumption Quantity Electric Fuel Consumption Quantity Total Fuel Consumption MMBtu Elec Fuel Consumption MMBtu Net Generation (Megawatthours) YEAR
6841 99999 Y NaN State-Fuel Level Increment State-Fuel Level Increment 99999 WY MTN NaN NaN ... 20.03 20.073 . . 2471 197 14391 1144 225.055 2016
6842 99999 Y NaN State-Fuel Level Increment State-Fuel Level Increment 99999 WY MTN NaN NaN ... 8371.86 6890.44 . . 5750996 817170 5662749 804426 84996.866 2016
6843 99999 Y NaN State-Fuel Level Increment State-Fuel Level Increment 99999 WY MTN NaN NaN ... 282.565 112.177 . . 7449697 152028 1362700 27810 3212.683 2016
6844 99999 Y NaN State-Fuel Level Increment State-Fuel Level Increment 99999 WY MTN NaN NaN ... 0 0 . . 0 0 0 0 0.000 2016
6845 99999 Y NaN State-Fuel Level Increment State-Fuel Level Increment 99999 WY MTN NaN NaN ... 10293 7668.97 . . 406340 92966 7110741 1626327 133198.240 2016

5 rows × 97 columns


In [64]:
generation.replace('.', np.nan, inplace=True)

In [65]:
generation.head()


Out[65]:
Plant Id Combined Heat And Power Plant Nuclear Unit Id Plant Name Operator Name Operator Id Plant State Census Region NERC Region Reserved ... Netgen September Netgen October Netgen November Netgen December Total Fuel Consumption Quantity Electric Fuel Consumption Quantity Total Fuel Consumption MMBtu Elec Fuel Consumption MMBtu Net Generation (Megawatthours) YEAR
0 3 N NaN Barry Alabama Power Co 195 AL ESC SERC NaN ... 251839.000 219263.000 NaN NaN 4782719 4782719 4877614 4877614 2386339.000 2016
1 3 N NaN Barry Alabama Power Co 195 AL ESC SERC NaN ... 463646.000 401506.000 NaN NaN 42413079 42413079 43208127 43208127 4486082.000 2016
2 3 N NaN Barry Alabama Power Co 195 AL ESC SERC NaN ... 473793.700 286736.320 NaN NaN 1773704 1773704 37426485 37426485 3706973.300 2016
3 3 N NaN Barry Alabama Power Co 195 AL ESC SERC NaN ... 11246.298 14387.682 NaN NaN 857741 857741 874585 874585 86059.704 2016
4 4 N NaN Walter Bouldin Dam Alabama Power Co 195 AL ESC SERC NaN ... 3380.000 884.000 NaN NaN 0 0 4239930 4239930 454977.000 2016

5 rows × 97 columns


In [67]:
generation.dropna(axis=1, how='all', inplace=True)

In [68]:
generation.columns


Out[68]:
Index([u'Plant Id', u'Combined Heat And\nPower Plant', u'Nuclear Unit Id',
       u'Plant Name', u'Operator Name', u'Operator Id', u'Plant State',
       u'Census Region', u'NERC Region', u'NAICS Code', u'EIA Sector Number',
       u'Sector Name', u'Reported\nPrime Mover', u'Reported\nFuel Type Code',
       u'AER\nFuel Type Code', u'Physical\nUnit Label', u'Quantity\nJanuary',
       u'Quantity\nFebruary', u'Quantity\nMarch', u'Quantity\nApril',
       u'Quantity\nMay', u'Quantity\nJune', u'Quantity\nJuly',
       u'Quantity\nAugust', u'Quantity\nSeptember', u'Quantity\nOctober',
       u'Elec_Quantity\nJanuary', u'Elec_Quantity\nFebruary',
       u'Elec_Quantity\nMarch', u'Elec_Quantity\nApril', u'Elec_Quantity\nMay',
       u'Elec_Quantity\nJune', u'Elec_Quantity\nJuly',
       u'Elec_Quantity\nAugust', u'Elec_Quantity\nSeptember',
       u'Elec_Quantity\nOctober', u'MMBtuPer_Unit\nJanuary',
       u'MMBtuPer_Unit\nFebruary', u'MMBtuPer_Unit\nMarch',
       u'MMBtuPer_Unit\nApril', u'MMBtuPer_Unit\nMay', u'MMBtuPer_Unit\nJune',
       u'MMBtuPer_Unit\nJuly', u'MMBtuPer_Unit\nAugust',
       u'MMBtuPer_Unit\nSeptember', u'MMBtuPer_Unit\nOctober',
       u'Tot_MMBtu\nJanuary', u'Tot_MMBtu\nFebruary', u'Tot_MMBtu\nMarch',
       u'Tot_MMBtu\nApril', u'Tot_MMBtu\nMay', u'Tot_MMBtu\nJune',
       u'Tot_MMBtu\nJuly', u'Tot_MMBtu\nAugust', u'Tot_MMBtu\nSeptember',
       u'Tot_MMBtu\nOctober', u'Elec_MMBtu\nJanuary', u'Elec_MMBtu\nFebruary',
       u'Elec_MMBtu\nMarch', u'Elec_MMBtu\nApril', u'Elec_MMBtu\nMay',
       u'Elec_MMBtu\nJune', u'Elec_MMBtu\nJuly', u'Elec_MMBtu\nAugust',
       u'Elec_MMBtu\nSeptember', u'Elec_MMBtu\nOctober', u'Netgen\nJanuary',
       u'Netgen\nFebruary', u'Netgen\nMarch', u'Netgen\nApril', u'Netgen\nMay',
       u'Netgen\nJune', u'Netgen\nJuly', u'Netgen\nAugust',
       u'Netgen\nSeptember', u'Netgen\nOctober',
       u'Total Fuel Consumption\nQuantity',
       u'Electric Fuel Consumption\nQuantity',
       u'Total Fuel Consumption\nMMBtu', u'Elec Fuel Consumption\nMMBtu',
       u'Net Generation\n(Megawatthours)', u'YEAR'],
      dtype='object')

In [69]:
generation.columns = [name.strip().replace('\n', ' ') for name in generation.columns]
generation.columns


Out[69]:
Index([u'Plant Id', u'Combined Heat And Power Plant', u'Nuclear Unit Id',
       u'Plant Name', u'Operator Name', u'Operator Id', u'Plant State',
       u'Census Region', u'NERC Region', u'NAICS Code', u'EIA Sector Number',
       u'Sector Name', u'Reported Prime Mover', u'Reported Fuel Type Code',
       u'AER Fuel Type Code', u'Physical Unit Label', u'Quantity January',
       u'Quantity February', u'Quantity March', u'Quantity April',
       u'Quantity May', u'Quantity June', u'Quantity July', u'Quantity August',
       u'Quantity September', u'Quantity October', u'Elec_Quantity January',
       u'Elec_Quantity February', u'Elec_Quantity March',
       u'Elec_Quantity April', u'Elec_Quantity May', u'Elec_Quantity June',
       u'Elec_Quantity July', u'Elec_Quantity August',
       u'Elec_Quantity September', u'Elec_Quantity October',
       u'MMBtuPer_Unit January', u'MMBtuPer_Unit February',
       u'MMBtuPer_Unit March', u'MMBtuPer_Unit April', u'MMBtuPer_Unit May',
       u'MMBtuPer_Unit June', u'MMBtuPer_Unit July', u'MMBtuPer_Unit August',
       u'MMBtuPer_Unit September', u'MMBtuPer_Unit October',
       u'Tot_MMBtu January', u'Tot_MMBtu February', u'Tot_MMBtu March',
       u'Tot_MMBtu April', u'Tot_MMBtu May', u'Tot_MMBtu June',
       u'Tot_MMBtu July', u'Tot_MMBtu August', u'Tot_MMBtu September',
       u'Tot_MMBtu October', u'Elec_MMBtu January', u'Elec_MMBtu February',
       u'Elec_MMBtu March', u'Elec_MMBtu April', u'Elec_MMBtu May',
       u'Elec_MMBtu June', u'Elec_MMBtu July', u'Elec_MMBtu August',
       u'Elec_MMBtu September', u'Elec_MMBtu October', u'Netgen January',
       u'Netgen February', u'Netgen March', u'Netgen April', u'Netgen May',
       u'Netgen June', u'Netgen July', u'Netgen August', u'Netgen September',
       u'Netgen October', u'Total Fuel Consumption Quantity',
       u'Electric Fuel Consumption Quantity', u'Total Fuel Consumption MMBtu',
       u'Elec Fuel Consumption MMBtu', u'Net Generation (Megawatthours)',
       u'YEAR'],
      dtype='object')

In [70]:
'May' in 'Quantity May'


Out[70]:
True

In [71]:
'Quantity May'.split()


Out[71]:
['Quantity', 'May']

In [80]:
id_cols = ['Plant Id', 'NERC Region', 'AER Fuel Type Code']
monthly_cols = []

def find_col_names(cols):
#     monthly_cols1 = []
    for col in cols:
        if 'January' in col:
            monthly_cols.append(col.split()[0])
#     return monthly_cols1

In [75]:
temp = find_col_names(generation.columns)
temp


Out[75]:
[u'Quantity',
 u'Elec_Quantity',
 u'MMBtuPer_Unit',
 u'Tot_MMBtu',
 u'Elec_MMBtu',
 u'Netgen']

In [81]:
find_col_names(generation.columns)
monthly_cols


Out[81]:
[u'Quantity',
 u'Elec_Quantity',
 u'MMBtuPer_Unit',
 u'Tot_MMBtu',
 u'Elec_MMBtu',
 u'Netgen']

In [82]:
gen_may = pd.DataFrame(columns=id_cols + monthly_cols)
gen_may


Out[82]:
Plant Id NERC Region AER Fuel Type Code Quantity Elec_Quantity MMBtuPer_Unit Tot_MMBtu Elec_MMBtu Netgen

In [83]:
gen_may[id_cols] = generation.loc[:,id_cols]
gen_may.head()


Out[83]:
Plant Id NERC Region AER Fuel Type Code Quantity Elec_Quantity MMBtuPer_Unit Tot_MMBtu Elec_MMBtu Netgen
0 3 SERC NG NaN NaN NaN NaN NaN NaN
1 3 SERC NG NaN NaN NaN NaN NaN NaN
2 3 SERC COL NaN NaN NaN NaN NaN NaN
3 3 SERC NG NaN NaN NaN NaN NaN NaN
4 4 SERC HYC NaN NaN NaN NaN NaN NaN

In [84]:
for col in monthly_cols:
    gen_may[col] = generation.loc[:,col + ' May']

In [85]:
gen_may.head()


Out[85]:
Plant Id NERC Region AER Fuel Type Code Quantity Elec_Quantity MMBtuPer_Unit Tot_MMBtu Elec_MMBtu Netgen
0 3 SERC NG 64489.0 64489.0 1.017 65585.0 65585.0 223662.00
1 3 SERC NG 4355654.0 4355654.0 1.017 4429700.0 4429700.0 421779.00
2 3 SERC COL 178956.0 178956.0 21.425 3834132.0 3834132.0 376726.94
3 3 SERC NG 63097.0 63097.0 1.017 64170.0 64170.0 6305.06
4 4 SERC HYC 0.0 0.0 0.000 95361.0 95361.0 10233.00

Groupby facilities


In [86]:
facility_gen = gen_may.groupby(['Plant Id', 'NERC Region']).sum()
facility_gen.head()


Out[86]:
Quantity Elec_Quantity MMBtuPer_Unit Tot_MMBtu Elec_MMBtu Netgen
Plant Id NERC Region
3 SERC 4662196.0 4662196.0 24.476 8393587.0 8393587.0 1028473.000
4 SERC 0.0 0.0 0.000 95361.0 95361.0 10233.000
8 SERC 188233.0 188233.0 30.364 4588547.0 4588547.0 471836.004
10 SERC 116191.0 116191.0 2.066 120025.0 120025.0 6734.000
14 SERC 0.0 0.0 0.000 132060.0 132060.0 14171.000

In [87]:
facility_gen.reset_index('NERC Region', inplace=True)
facility_gen.head()


Out[87]:
NERC Region Quantity Elec_Quantity MMBtuPer_Unit Tot_MMBtu Elec_MMBtu Netgen
Plant Id
3 SERC 4662196.0 4662196.0 24.476 8393587.0 8393587.0 1028473.000
4 SERC 0.0 0.0 0.000 95361.0 95361.0 10233.000
8 SERC 188233.0 188233.0 30.364 4588547.0 4588547.0 471836.004
10 SERC 116191.0 116191.0 2.066 120025.0 120025.0 6734.000
14 SERC 0.0 0.0 0.000 132060.0 132060.0 14171.000

Merge data from all three source


In [88]:
merged = facility_gen.merge(facility_cap, how='inner', 
                            left_index=True, right_index=True)

In [89]:
merged.head()


Out[89]:
NERC Region Quantity Elec_Quantity MMBtuPer_Unit Tot_MMBtu Elec_MMBtu Netgen Nameplate Capacity (MW)
3 SERC 4662196.0 4662196.0 24.476 8393587.0 8393587.0 1028473.000 2569.5
4 SERC 0.0 0.0 0.000 95361.0 95361.0 10233.000 225.0
8 SERC 188233.0 188233.0 30.364 4588547.0 4588547.0 471836.004 1166.7
10 SERC 116191.0 116191.0 2.066 120025.0 120025.0 6734.000 1288.4
14 SERC 0.0 0.0 0.000 132060.0 132060.0 14171.000 128.1

In [90]:
final = merged.merge(facility_emiss, how='outer', 
                     left_index=True, right_index=True)

In [92]:
final.head()


Out[92]:
NERC Region Quantity Elec_Quantity MMBtuPer_Unit Tot_MMBtu Elec_MMBtu Netgen Nameplate Capacity (MW) Operating Time Gross Load (MW-h) Steam Load (1000lb) SO2 (tons) Avg. NOx Rate (lb/MMBtu) NOx (tons) CO2 (short tons) Heat Input (MMBtu) EPA Region
3 SERC 4662196.0 4662196.0 24.476 8393587.0 8393587.0 1028473.000 2569.5 3844.00 1048450.25 NaN 595.911 0.5760 411.165 677078.976 8471790.125 4.0
4 SERC 0.0 0.0 0.000 95361.0 95361.0 10233.000 225.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
7 NaN NaN NaN NaN NaN NaN NaN NaN 924.00 NaN 222159.75 0.990 0.2067 13.814 15771.300 266053.425 4.0
8 SERC 188233.0 188233.0 30.364 4588547.0 4588547.0 471836.004 1166.7 1837.25 505777.25 NaN 125.662 0.5375 440.348 531418.603 5179513.525 4.0
9 NaN NaN NaN NaN NaN NaN NaN NaN 20.60 541.68 NaN 0.003 0.2751 1.504 NaN 10441.833 6.0

In [94]:
final.reset_index(inplace=True)
final.head()


Out[94]:
index NERC Region Quantity Elec_Quantity MMBtuPer_Unit Tot_MMBtu Elec_MMBtu Netgen Nameplate Capacity (MW) Operating Time Gross Load (MW-h) Steam Load (1000lb) SO2 (tons) Avg. NOx Rate (lb/MMBtu) NOx (tons) CO2 (short tons) Heat Input (MMBtu) EPA Region
0 3 SERC 4662196.0 4662196.0 24.476 8393587.0 8393587.0 1028473.000 2569.5 3844.00 1048450.25 NaN 595.911 0.5760 411.165 677078.976 8471790.125 4.0
1 4 SERC 0.0 0.0 0.000 95361.0 95361.0 10233.000 225.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2 7 NaN NaN NaN NaN NaN NaN NaN NaN 924.00 NaN 222159.75 0.990 0.2067 13.814 15771.300 266053.425 4.0
3 8 SERC 188233.0 188233.0 30.364 4588547.0 4588547.0 471836.004 1166.7 1837.25 505777.25 NaN 125.662 0.5375 440.348 531418.603 5179513.525 4.0
4 9 NaN NaN NaN NaN NaN NaN NaN NaN 20.60 541.68 NaN 0.003 0.2751 1.504 NaN 10441.833 6.0

In [102]:
final = final.rename(columns={'index':'Plant ID'})

In [103]:
final


Out[103]:
Plant ID NERC Region Quantity Elec_Quantity MMBtuPer_Unit Tot_MMBtu Elec_MMBtu Netgen Nameplate Capacity (MW) Operating Time Gross Load (MW-h) Steam Load (1000lb) SO2 (tons) Avg. NOx Rate (lb/MMBtu) NOx (tons) CO2 (short tons) Heat Input (MMBtu) EPA Region
0 3 SERC 4662196.0 4662196.0 24.476 8393587.0 8393587.0 1028473.000 2569.5 3844.00 1048450.25 NaN 595.911 0.5760 411.165 677078.976 8471790.125 4.0
1 4 SERC 0.0 0.0 0.000 95361.0 95361.0 10233.000 225.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2 7 NaN NaN NaN NaN NaN NaN NaN NaN 924.00 NaN 222159.75 0.990 0.2067 13.814 15771.300 266053.425 4.0
3 8 SERC 188233.0 188233.0 30.364 4588547.0 4588547.0 471836.004 1166.7 1837.25 505777.25 NaN 125.662 0.5375 440.348 531418.603 5179513.525 4.0
4 9 NaN NaN NaN NaN NaN NaN NaN NaN 20.60 541.68 NaN 0.003 0.2751 1.504 NaN 10441.833 6.0
5 10 SERC 116191.0 116191.0 2.066 120025.0 120025.0 6734.000 1288.4 188.25 8897.75 NaN 48.579 0.8474 10.162 11340.124 144258.150 4.0
6 14 SERC 0.0 0.0 0.000 132060.0 132060.0 14171.000 128.1 NaN NaN NaN NaN NaN NaN NaN NaN NaN
7 15 SERC 0.0 0.0 0.000 219444.0 219444.0 23548.000 177.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
8 16 SERC 0.0 0.0 0.000 145265.0 145265.0 15588.000 210.6 NaN NaN NaN NaN NaN NaN NaN NaN NaN
9 17 SERC 0.0 0.0 0.000 193742.0 193742.0 20790.000 170.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
10 18 SERC 0.0 0.0 0.000 54386.0 54386.0 5836.000 181.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
11 26 SERC 197510.0 197510.0 30.196 4577634.0 4577634.0 453833.000 2034.0 744.00 495791.00 NaN 173.698 0.0646 165.370 524604.900 5113099.400 4.0
12 46 SERC 0.0 0.0 0.000 25805554.0 25805554.0 2467542.000 3494.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
13 47 SERC 58.0 58.0 5.800 336.0 336.0 62.000 1026.0 20.00 177.00 NaN 0.333 4.4379 0.722 192.400 2765.600 4.0
14 48 SERC 0.0 0.0 0.000 177946.0 177946.0 19095.000 115.2 NaN NaN NaN NaN NaN NaN NaN NaN NaN
15 49 SERC 0.0 0.0 0.000 261286.0 261286.0 28038.000 404.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
16 50 SERC 0.0 0.0 0.000 0.0 0.0 0.000 575.0 0.00 NaN NaN NaN NaN NaN NaN NaN 4.0
17 51 SPP 241664.0 241664.0 14.902 2799148.0 2799148.0 238020.998 720.7 553.48 262392.63 NaN 1081.656 0.2080 241.863 270128.775 2481213.560 6.0
18 54 SERC 177832.0 177832.0 1.066 189569.0 189569.0 15037.000 1055.0 254.45 15652.65 NaN 0.057 0.3753 2.787 11101.898 186799.693 4.0
19 56 SERC 49159.0 49159.0 28.560 1098557.0 1098557.0 97056.000 538.0 759.23 112793.47 NaN 63.902 0.5125 167.878 129301.129 1260257.488 4.0
20 59 NaN NaN NaN NaN NaN NaN NaN NaN 321.07 18822.00 NaN 16.264 0.2297 24.957 21946.742 209245.816 7.0
21 60 MRO 24713.0 24713.0 22.206 404792.0 404792.0 31448.000 324.3 753.95 36111.00 NaN 176.503 0.2169 39.165 44877.292 427905.242 7.0
22 64 ASCC 102.0 102.0 5.712 583.0 583.0 21.000 61.7 NaN NaN NaN NaN NaN NaN NaN NaN NaN
23 77 ASCC 0.0 0.0 0.000 84617.0 84617.0 9080.000 44.4 NaN NaN NaN NaN NaN NaN NaN NaN NaN
24 78 ASCC 0.0 0.0 0.000 157007.0 157007.0 16848.000 78.2 NaN NaN NaN NaN NaN NaN NaN NaN NaN
25 87 WECC 52499.0 52499.0 19.578 867759.0 867759.0 74925.000 257.0 744.00 82439.00 NaN 34.069 0.3811 161.168 88806.200 846735.000 6.0
26 96 ASCC 76562.0 76562.0 1.000 76562.0 76562.0 3455.000 312.4 NaN NaN NaN NaN NaN NaN NaN NaN NaN
27 104 WECC 106.0 106.0 0.000 0.0 0.0 44845.000 199.8 NaN NaN NaN NaN NaN NaN NaN NaN NaN
28 108 SPP 102821.0 102821.0 18.837 1607158.0 1607158.0 146461.005 348.7 660.18 160882.24 NaN 95.013 0.1813 151.412 173507.748 1654354.527 7.0
29 113 WECC 68608.0 68608.0 24.756 1253737.0 1253737.0 103305.000 839.9 992.93 120001.76 NaN 57.635 0.6462 149.985 135364.206 1319344.965 9.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2480 59654 TRE 0.0 0.0 0.000 243748.0 243748.0 26156.000 78.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2481 59655 MRO 0.0 0.0 0.000 313100.0 313100.0 33598.000 97.8 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2482 59702 WECC 0.0 0.0 0.000 141779.0 141779.0 15214.000 50.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2483 59723 WECC 0.0 0.0 0.000 141024.0 141024.0 15133.000 30.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2484 59732 TRE 0.0 0.0 0.000 408918.0 408918.0 43880.000 150.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2485 59733 TRE 0.0 0.0 0.000 392479.0 392479.0 42116.000 150.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2486 59734 TRE 0.0 0.0 0.000 405451.0 405451.0 43508.000 150.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2487 59778 SERC 0.0 0.0 0.000 65186.0 65186.0 6995.000 47.7 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2488 59784 WECC 1339613.0 1339613.0 1.024 1371764.0 1371764.0 187059.000 619.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2489 59837 SPP 0.0 0.0 0.000 465577.0 465577.0 49960.000 150.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2490 59838 SPP 0.0 0.0 0.000 181338.0 181338.0 19459.000 50.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2491 59862 SERC 0.0 0.0 0.000 58831.0 58831.0 6313.000 30.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2492 59894 SERC 0.0 0.0 0.000 66202.0 66202.0 7104.000 30.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2493 59926 NaN NaN NaN NaN NaN NaN NaN NaN 24.63 2794.92 NaN 0.015 0.0320 0.806 2972.500 50368.700 5.0
2494 59943 TRE 0.0 0.0 0.000 757169.0 757169.0 81250.000 207.2 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2495 59944 SERC 0.0 0.0 0.000 144920.0 144920.0 15551.000 80.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2496 59965 WECC 0.0 0.0 0.000 89956.0 89956.0 9653.000 62.1 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2497 59974 WECC 0.0 0.0 0.000 690044.0 690044.0 74047.000 250.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2498 59975 WECC 0.0 0.0 0.000 317582.0 317582.0 34079.000 150.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2499 60008 WECC 0.0 0.0 0.000 127866.0 127866.0 13721.000 52.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2500 60013 SPP 0.0 0.0 0.000 410055.0 410055.0 44002.000 151.8 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2501 60049 WECC 0.0 0.0 0.000 306101.0 306101.0 32847.000 80.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2502 60059 TRE 0.0 0.0 0.000 295142.0 295142.0 31671.000 110.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2503 60069 SPP 0.0 0.0 0.000 612939.0 612939.0 65773.000 198.6 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2504 60093 WECC 0.0 0.0 0.000 263569.0 263569.0 28283.000 109.8 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2505 60104 TRE 0.0 0.0 0.000 796420.0 796420.0 85462.000 249.7 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2506 60262 SPP 0.0 0.0 0.000 240132.0 240132.0 25768.000 73.4 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2507 60314 SPP 0.0 0.0 0.000 103935.0 103935.0 11153.000 35.8 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2508 60419 WECC 0.0 0.0 0.000 142450.0 142450.0 15286.000 25.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
2509 70454 NaN NaN NaN NaN NaN NaN NaN NaN 62.78 7178.74 NaN 0.026 0.1711 3.388 5164.599 86899.023 4.0

2510 rows × 18 columns


In [104]:
final.to_csv('Final_monday.csv', index=False)

In [ ]: